/* 
 * File:   main.cpp
 * Author: tjandreau
 *
 * Created on December 22, 2012, 9:49 AM
 */

#include <cstdlib>
#include "test_Logging.h"

CPPUNIT_TEST_SUITE_REGISTRATION(TEST::TestLogging);

int main() {

    // creates the event manager and controller
    CPPUNIT_NS::TestResult controller;

    // adds a listener
    CPPUNIT_NS::TestResultCollector result;
    controller.addListener(&result);

    // adds something that prints progress
    CPPUNIT_NS::BriefTestProgressListener progress;
    controller.addListener(&progress);

    // add the top suite to the test runner
    CPPUNIT_NS::TestRunner runner;
    runner.addTest(CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest());
    runner.run(controller);

    CPPUNIT_NS::CompilerOutputter compilerOutputter(&result, std::cout);
    compilerOutputter.write();

    ///home/tjandreau/DEV/TestResults
    std::string testResults = "../results/testLogging.xml";
    std::cout << " Writing output - " << testResults << std::endl;
    std::ofstream xmlFileOut(testResults.c_str());
    CPPUNIT_NS::XmlOutputter xmlOut(&result, xmlFileOut);
    xmlOut.write();

    return result.wasSuccessful() ? 0 : 1;
}

